package com.example.demo2.entity;


import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.alibaba.excel.annotation.write.style.ContentRowHeight;
import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;
import java.util.List;

@Data
@ExcelIgnoreUnannotated
@EqualsAndHashCode
@ContentRowHeight(20)
@HeadRowHeight(20)
@ColumnWidth(20)
@TableName("sys_order")
public class Order {
    @ExcelProperty(value = "订单编号")
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    @ExcelProperty(value = "开始寄放日期")
    private String startLodgingTime;
    @ExcelProperty(value = "结束寄放日期")
    private String endLodgingTime;
    @ExcelProperty(value = "行李箱数量")
    private Integer bigNum;
    @ExcelProperty(value = "背包数量")
    private Integer middleNum;
    private Integer shopId;
    private Integer userId;
    @ExcelProperty(value = "订购价格")
    private String totalMoney;
    @ExcelProperty(value = "订购状态")
    private String state;
    @ExcelProperty(value = "一共租用天数")
    private String totalDays;
    @ExcelProperty(value = "审核不通过原因")
    private String errReason;
    @ExcelProperty(value = "订单创建日期")
    @TableField(value = "create_time")
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private LocalDateTime createTime;
    @TableLogic(value = "0", delval = "1")
//    由于 isDelete 添加了 @TableLogic 注解，MyBatis Plus 做所有查询操作时，自动会在 where 条件后面拼上 is_del = 0，所以 is_del 置一后，实现了逻辑删除
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) //逻辑删除不返回给前端
    private Integer isDelete;
    @TableField(exist = false)
    private ShopPlace shopPlace;
    @TableField(exist = false)
    private Customer customer;
    @TableField(exist = false)
    private List<Integer> ids;
    @TableField(exist = false)
    @ExcelProperty(value = "寄放点名称")
    private String shopName;
    @TableField(exist = false)
    @ExcelProperty(value = "寄放城市")
    private String shopCity;
    @TableField(exist = false)
    @ExcelProperty(value = "顾客昵称")
    private String customerName;
    @TableField(exist = false)
    @ExcelProperty(value = "顾客手机号")
    private String customerPhone;
}

